import request from '@/utils/Request'

// 查询商户产品列表
export function listMerchantProduct(query: any) {
  return request({
    url: '/merchant/product/fetch',
    method: 'get',
    params: query
  })
}

// 查询商户产品详细信息
export function getMerchantProduct(id: string) {
  return request({
    url: `/merchant/product/${id}`,
    method: 'get',
  })
}

// 新增商户产品
export function addMerchantProduct(data: any) {
  return request({
    url: '/merchant/product',
    method: 'post',
    data: data
  })
}

// 修改商户产品
export function updateMerchantProduct(data: any) {
  return request({
    url: '/merchant/product',
    method: 'put',
    data: data
  })
}

// 删除商户产品
export function delMerchantProduct(ids: any) {
  return request({
    url: '/merchant/product/batch',
    method: 'delete',
    data: ids instanceof Array ? ids : [ids]
  })
}

// 获取商户列表
export function listMerchant(query?: any) {
  return request({
    url: '/merchant/fetch',
    method: 'get',
    params: query
  })
}

// 获取产品列表
export function listProduct(query?: any) {
  return request({
    url: '/product/fetch',
    method: 'get',
    params: query
  })
}